package ovm.entity;

import javax.persistence.*;
import java.math.BigInteger;

/**
 * Created by IntelliJ IDEA.
 * User: Jokser
 * Date: 26.05.12
 * Time: 8:16
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "SCHEDULE", schema = "DBO_DIPLOM_NEW", catalog = "")
@Entity
public class ScheduleEntity {
    private int weekType;

    @javax.persistence.Column(name = "WEEK_TYPE")
    @Basic
    public int getWeekType() {
        return weekType;
    }

    public void setWeekType(int weekType) {
        this.weekType = weekType;
    }

    private StudyGroupEntity studyGroup;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "STUDY_GROUP", referencedColumnName = "ID", nullable = false)
    StudyGroupEntity getStudyGroup() {
        return studyGroup;
    }

    public void setStudyGroup(StudyGroupEntity studyGroup) {
        this.studyGroup = studyGroup;
    }

    private int id;

    @javax.persistence.Column(name = "ID")
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ScheduleEntity that = (ScheduleEntity) o;

        if (id != that.id) return false;
        if (weekType != that.weekType) return false;
        if (studyGroup != that.studyGroup) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = weekType;
        result = 31 * result + studyGroup.hashCode();
        result = 31 * result + id;
        return result;
    }

    private DaysEntity daysByDay;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "DAY", referencedColumnName = "ID", nullable = false)
    DaysEntity getDaysByDay() {
        return daysByDay;
    }

    public void setDaysByDay(DaysEntity daysByDay) {
        this.daysByDay = daysByDay;
    }

    private RoomEntity roomByRoom;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "ROOM", referencedColumnName = "ID", nullable = false)
    RoomEntity getRoomByRoom() {
        return roomByRoom;
    }

    public void setRoomByRoom(RoomEntity roomByRoom) {
        this.roomByRoom = roomByRoom;
    }

    private SubjectEntity subjectBySubject;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "SUBJECT", referencedColumnName = "ID", nullable = false)
    SubjectEntity getSubjectBySubject() {
        return subjectBySubject;
    }

    public void setSubjectBySubject(SubjectEntity subjectBySubject) {
        this.subjectBySubject = subjectBySubject;
    }

    private SubjectTypeEntity subjectTypeBySubjectType;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "SUBJECT_TYPE", referencedColumnName = "ID", nullable = false)
    SubjectTypeEntity getSubjectTypeBySubjectType() {
        return subjectTypeBySubjectType;
    }

    public void setSubjectTypeBySubjectType(SubjectTypeEntity subjectTypeBySubjectType) {
        this.subjectTypeBySubjectType = subjectTypeBySubjectType;
    }

    private TeacherEntity teacherByTeacher;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "TEACHER", referencedColumnName = "ID", nullable = false)
    TeacherEntity getTeacherByTeacher() {
        return teacherByTeacher;
    }

    public void setTeacherByTeacher(TeacherEntity teacherByTeacher) {
        this.teacherByTeacher = teacherByTeacher;
    }

    private TimeEntity timeByStudyTime;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "STUDY_TIME", referencedColumnName = "ID", nullable = false)
    TimeEntity getTimeByStudyTime() {
        return timeByStudyTime;
    }

    public void setTimeByStudyTime(TimeEntity timeByStudyTime) {
        this.timeByStudyTime = timeByStudyTime;
    }
}
